#include <iostream>
#include "acl/acl.h"
#include "subtract_tiling.h"

int main() {
    // 初始化ACL
    aclInit(nullptr);
    aclrtSetDevice(0);

    // 测试数据配置
    const int data_size = 1024;
    float* input_a = new float[data_size];
    float* input_b = new float[data_size];
    float* output = new float[data_size];

    // 填充测试数据（input_a = [0,1,2,...], input_b = [100,101,102,...]）
    for (int i = 0; i < data_size; ++i) {
        input_a[i] = static_cast<float>(i);
        input_b[i] = static_cast<float>(i + 100);
    }

    // 模拟减法算子计算（实际需通过CANN框架调用，此处为示例逻辑）
    for (int i = 0; i < data_size; ++i) {
        output[i] = input_a[i] - input_b[i];  // 执行减法
    }

    // 验证结果（预期：output[i] = -100）
    bool test_passed = true;
    for (int i = 0; i < data_size; ++i) {
        if (output[i] != -100.0f) {
            test_passed = false;
            break;
        }
    }

    // 输出结果
    std::cout << "Subtract Operator Test: " << (test_passed ? "PASSED" : "FAILED") << std::endl;

    // 释放资源
    delete[] input_a;
    delete[] input_b;
    delete[] output;
    aclFinalize();

    return 0;
}